#define __SPIDER_H__
#pragma once

#include "libraries.h"
#include "CCreature.h"
#include "Extern.h"

class CSpider : public CCreature
{
public:
	CSpider(int x, int y, int id)
	{
		Type = 1;
		ID = id;
		X = x;
		Y = y;
		SprX = X*32;
		SprY = Y*32;
		SprMoveX = 0;
		SprMoveY = 0;
		SprMovesLeft = 0;
		HP = 55;
		SharpDefense = 1;
		BluntDefense = 0;
		EXPDefense = 1;
		MoveCounter = 0;
		AttackCounter = 0;
		pObjectMap[X][Y] = this;
		NearestEnemy.Distance = 100;
		BlockMap[X][Y] = 1;
		UseWay = 0;
		StayPoint.X = X;
		StayPoint.Y = Y;
		Mother = 1;
		pMotherCreature = 0;
		for (int i = 0; i < 5; i++) pParasiteCreature[i] = 0;
	}
	~CSpider();
	bool Move();
	void Process(CCreature* pCreature)
	{
		if (AttackCounter <= 0)
		{
			if (X - 1 <= pCreature->GetX() && X + 1 >= pCreature->GetX() && Y - 1 <= pCreature->GetY() && Y + 1 >= pCreature->GetY())
			{
				pCreature->SharpHit(10 + rand() % 3);
				AttackCounter = 17;
				return;
			}
			if (X - 7 <= pCreature->GetX() && X + 7 >= pCreature->GetX() && Y - 7 <= pCreature->GetY() && Y + 7 >= pCreature->GetY())
			{
				RunRay(pCreature->GetX(), pCreature->GetY());
				return;
			}
		}
	}
	void Draw();
};